package cn.tedu._11weibo.base.config;

import cn.tedu._11weibo.base.interception.LoginCheckInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器【登录状态校验】
        //发布微博和发布评论功能：登录状态的校验使用拦截器实现
        registry.addInterceptor(new LoginCheckInterceptor())
                .addPathPatterns("/v1/weibo/**", "/v1/comment/**");
    }
}
